home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / ipworks / webster.fr_ / webster.fr (.txt)
Encoding:
Visual Basic Form  |  1996-03-13  |  4.1 KB  |  134 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Webster Client"
  5.    ClientHeight    =   3105
  6.    ClientLeft      =   1140
  7.    ClientTop       =   1500
  8.    ClientWidth     =   4305
  9.    Height          =   3510
  10.    Left            =   1080
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3105
  13.    ScaleWidth      =   4305
  14.    Top             =   1155
  15.    Width           =   4425
  16.    Begin TextBox tWord 
  17.       Height          =   285
  18.       Left            =   720
  19.       TabIndex        =   3
  20.       Text            =   "webster"
  21.       Top             =   120
  22.       Width           =   2175
  23.    End
  24.    Begin TextBox tDesc 
  25.       FontBold        =   0   'False
  26.       FontItalic      =   0   'False
  27.       FontName        =   "MS Sans Serif"
  28.       FontSize        =   8.25
  29.       FontStrikethru  =   0   'False
  30.       FontUnderline   =   0   'False
  31.       Height          =   2535
  32.       Left            =   0
  33.       MultiLine       =   -1  'True
  34.       TabIndex        =   2
  35.       Top             =   480
  36.       Width           =   4215
  37.    End
  38.    Begin CommandButton bLookUp 
  39.       Caption         =   "Look Up!!"
  40.       Default         =   -1  'True
  41.       Height          =   315
  42.       Left            =   3000
  43.       TabIndex        =   1
  44.       Top             =   105
  45.       Width           =   1215
  46.    End
  47.    Begin IPPORT IPPort1 
  48.       EOL             =   ""
  49.       Height          =   420
  50.       InBufferSize    =   2048
  51.       KeepAlive       =   0   'False
  52.       Left            =   3000
  53.       Linger          =   -1  'True
  54.       LocalPort       =   0
  55.       MaxLineLength   =   2048
  56.       OutBufferSize   =   2048
  57.       RegHandle       =   WEBSTER.FRX:0000
  58.       RemoteHost      =   ""
  59.       RemotePort      =   0
  60.       Top             =   0
  61.       Width           =   420
  62.       WinsockLoaded   =   0   'False
  63.    End
  64.    Begin Label Label1 
  65.       BackStyle       =   0  'Transparent
  66.       Caption         =   "WORD:"
  67.       Height          =   255
  68.       Left            =   30
  69.       TabIndex        =   0
  70.       Top             =   150
  71.       Width           =   615
  72.    End
  73. Sub bLookUp_Click ()
  74. IPPort1.WinsockLoaded = True
  75. IPPort1.EOL = Chr$(10)
  76. 'close old connections (if any)
  77. If IPPort1.Connected Then IPPort1.Connected = False
  78. 'set the remote host
  79. tDesc.Text = "Looking up host citi.umich.edu..."
  80. IPPort1.RemoteHost = "citi.umich.edu"
  81. IPPort1.RemotePort = 2627
  82. 'attempt connection
  83. tDesc.Text = "Connecting to " & IPPort1.RemoteHost & "...   "
  84. IPPort1.Connected = True
  85. 'wait until the connection is achieved
  86. '(timeout in 10 seconds)
  87. After10Seconds = Now + 10# / (3600# * 24#)
  88. Do Until Now > After10Seconds
  89.     If IPPort1.Connected Then Exit Do
  90.     DoEvents
  91. If Not IPPort1.Connected Then
  92.     MsgBox "Connection timed out."
  93.     tDesc.Text = ""
  94.     Exit Sub
  95. End If
  96. 'send the data
  97. IPPort1.DataToSend = "DEFINE " & tWord & Chr$(10)
  98. End Sub
  99. Sub Form_Load ()
  100. tDesc = "This is a very simple Webster client." & Chr$(13) & Chr$(10)
  101. tDesc = tDesc & "It connects to a dictionary on the net." & Chr$(13) & Chr$(10)
  102. tDesc = tDesc & "You can enter text above, or just" & Chr$(13) & Chr$(10)
  103. tDesc = tDesc & "doubleclick a word here."
  104. End Sub
  105. Sub Form_Resize ()
  106. If WindowState <> 1 Then
  107.     margin% = tDesc.Left
  108.     tDesc.Width = ScaleWidth - 2 * margin%
  109.     tDesc.Height = ScaleHeight - tDesc.Top - margin%
  110. End If
  111. End Sub
  112. Sub IPPort1_Connected (StatusCode As Integer, Description As String)
  113. tDesc.SelStart = Len(tDesc.Text)
  114. If StatusCode <> 0 Then
  115.     tDesc.SelText = "Connection failed: " & Description & Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10)
  116.     tDesc = ""
  117. End If
  118. End Sub
  119. Sub IPPort1_DataIn (Text As String, EOL As Integer)
  120. tDesc.SelStart = Len(tDesc.Text)
  121. tDesc.SelText = Text & Chr$(13) & Chr$(10)
  122. End Sub
  123. Sub IPPort1_Disconnected (StatusCode As Integer, Description As String)
  124. tDesc.SelStart = 0
  125. End Sub
  126. Sub tDesc_DblClick ()
  127. tWord = Trim$(tDesc.SelText)
  128. bLookUp = True
  129. 'select word
  130. tWord.SelStart = 0
  131. tWord.SelLength = Len(tWord)
  132. tWord.SetFocus
  133. End Sub
  134.